/*
 * Copyright (C) 2023 xuexiangjys(xuexiangjys@163.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.xuexiang.templateproject.intf;

import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/* compiled from: Message.java */
/* loaded from: classes.dex */
public class Message {

    /* renamed from: a  reason: collision with root package name */
    public String handlerName;

    /* renamed from: b  reason: collision with root package name */
    public String callbackId;

    /* renamed from: c  reason: collision with root package name */
    public String responseData;

    /* renamed from: d  reason: collision with root package name */
    public String responseId;

    /* renamed from: e  reason: collision with root package name */
    public String data;

    public static List<Message> k(String str) {
        ArrayList arrayList = new ArrayList();
        try {
            JSONArray jSONArray = new JSONArray(str);
            for (int i2 = 0; i2 < jSONArray.length(); i2++) {
                Message fVar = new Message();
                JSONObject jSONObject = jSONArray.getJSONObject(i2);
                String str2 = null;
                fVar.setHandlerName(jSONObject.has("handlerName") ? jSONObject.getString("handlerName") : null);
                fVar.setCallbackId(jSONObject.has("callbackId") ? jSONObject.getString("callbackId") : null);
                fVar.setResponseData(jSONObject.has("responseData") ? jSONObject.getString("responseData") : null);
                fVar.setResponseId(jSONObject.has("responseId") ? jSONObject.getString("responseId") : null);
                if (jSONObject.has("data")) {
                    str2 = jSONObject.getString("data");
                }
                fVar.setData(str2);
                arrayList.add(fVar);
            }
        } catch (JSONException e2) {
            e2.printStackTrace();
        }
        return arrayList;
    }

    public void setHandlerName(String str){
        handlerName = str;
    }
    public String getHandlerName(){
        return handlerName;
    }
    public void setCallbackId(String str){
        callbackId = str;
    }
    public String getCallbackId(){
        return callbackId;
    }
    public void setResponseData(String str){
        responseData = str;
    }
    public String getResponseData(){
        return responseData;
    }
    public void setResponseId(String str){
        responseId = str;
    }
    public String getResponseId(){
        return responseId;
    }
    public void setData(String str){
        data = str;
    }
    public String getData(){
        return data;
    }

    public String toString() {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("callbackId", getCallbackId());
            jSONObject.put("data", getData());
            jSONObject.put("handlerName", getHandlerName());
            jSONObject.put("responseData", getResponseData());
            jSONObject.put("responseId", getResponseId());
            return jSONObject.toString();
        } catch (JSONException e2) {
            e2.printStackTrace();
            return null;
        }
    }
}